/*
public  class J20250329 {
    public static void main(String[] args) {
        Dog dog1=new Dog();
        dog1.name="阿黄";
        dog1.age=1;
        dog1.color="黄色";
        dog1.sleep();
        dog1.eat();
        dog1.show();
        Dog dog2=new Dog("大白","white");
        dog2.show();
    }
}
class Dog{
    public String name;
    public int age;
    public String color;
    public void sleep(){
        System.out.println(this.name+"在睡觉");
    }
    public void eat(){
        System.out.println(this.name+"在吃饭");
    }
    public void show(){
        System.out.println("姓名："+this.name+" 年龄："+this.age+"  颜色："+this.color);
    }

    public Dog(String name, int age, String color) {
        this.name = name;
        this.age = age;
        this.color = color;
    }
    public Dog(String name, String color) {
        this.name = name;
        this.color = color;
    }
    public Dog() {

    }
}
*/
public class J20250329 {
    public static void main(String[] args) {
// 此处a没有初始化，编译时报错：
// Error:(24, 28) java: 可能尚未初始化变量a
// int a;
// System.out.println(a);
        Date d = new Date(2021,6,9);
    }
}
class Date {
    public int year;
    public int month;
    public int day;
    public Date(int year, int month, int day) {
// 成员变量在定义时，并没有给初始值, 为什么就可以使用呢？
        System.out.println(this.year);
        System.out.println(this.month);
        System.out.println(this.day);
    }
}
